<?php
class Merchant_Service_ReceivingItem
{
	public function __construct(){
		
	}

	public function add($row){
		$Obj = new Merchant_Model_ReceivingItem();
		return $Obj->add($row);		
	}
	
	public function update($row,$value,$field){
		$Obj = new Merchant_Model_ReceivingItem();
        $row['modified']=date('Y-m-d H:i:s');
		return $Obj->update($row,$value,$field);		
	}
	
	public function delete($value,$field){
		$Obj = new Merchant_Model_ReceivingItem();
		return $Obj->delete($value,$field);		
	}
	
	public function getByCond($cond,$type,$order,$count,$offset){
		$Obj = new Merchant_Model_ReceivingItem();
		$rows = $Obj->getByCond($cond,$type,$order,$count,$offset);
		return $rows;		
	}
	
	public function getAllByValue($value,$field){
		$Obj = new Merchant_Model_ReceivingItem();
		return $Obj->getAllByValue($value,$field);	
	}

	public static function getByReceivingAsnPid($cond)
	{ 
		if($cond['product_id']=='' || $cond['receiving_code']==''){
			return false;
		}
		$obj=new Merchant_Model_ReceivingItem();
		$rows=$obj->getByReceivingAsnPid($cond);
		if(!empty($rows)){
			$rows=$rows->toArray();
		}
		return $rows;
	}
	
}